﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Explorer.aspx.cs" Inherits="Zenui.Toolkit.Examples.Explorer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Zen UI Demo Explorer</title>
</head>
<body>
    <form id="form1" runat="server">
    <zen:ZenManager ID="ZenManager1" runat="server">
    </zen:ZenManager>
    <script type="text/javascript">

        function AddTab(item) {

            var tabs = dijit.byId("Tabstrip1");

            var store = dijit.byId("treeExplorer").model.store;
            var title = store.getValue(item, "name");

            var newTab = new dijit.layout.ContentPane({ href: "demos/index.htm", doLayout: true });
            dojo.mixin(newTab,
                                                        {
                                                            title: store.getValue(item, "name"),
                                                            closable: true
                                                        }
                                                );
            tabs.addChild(newTab);
            tabs.selectChild(newTab);
        }    
    
    </script>
    <zen:DataStore ID="DataStore1" runat="server">
        <Provider>
            <zen:FileReader runat="server" ClearOnClose="true" Hierarchical="false" ID="fileReader1"
                Url="~/demos/demo-explorer.txt">
            </zen:FileReader>
        </Provider>
    </zen:DataStore>
    <zen:BorderLayout ID="BorderLayout1" runat="server" Width="100%" Height="100%" Gutters="false"
        LiveSplitter="true">
        <Top runat="server" Height="50px" Splitter="false">
        </Top>
        <Left runat="server" Splitter="true" Width="200">
            <zen:Tree runat="server" ID="treeExplorer">
                <Model runat="server" ID="treeModel" StoreId="DataStore1" RootLabel="Zen UI Examples" RootId="zen"
                    Query="menu:'top'" />
                <ClientEvents>
                    <OnClick Script="AddTab" />
                </ClientEvents>
            </zen:Tree>
        </Left>
        <Center runat="server">
            <zen:Tabstrip ID="Tabstrip1" runat="server">
                <Panels>
                    <zen:Panel runat="server" Title="Welcome">
                        <!-- img src="img/zenui-logo.png" alt="Logo" / -->
                    </zen:Panel>
                </Panels>
            </zen:Tabstrip>
        </Center>
    </zen:BorderLayout>
    </form>
</body>
</html>
